home *** CD-ROM | disk | FTP | other *** search
- code segment
-
- assume cs:code,ds:code,es:code,ss:code
- org 0
-
- befehl equ 2
- status equ 3
- end_adr equ 14
-
- cmd equ 16384
- arg1 equ cmd+0
- arg2 equ cmd+2
- arg3 equ cmd+4
- arg4 equ cmd+6
- arg5 equ cmd+8
- arg6 equ cmd+10
- arg7 equ cmd+12
- arg8 equ cmd+14
-
- reg_bp equ 22
- reg_sp equ 20
- reg_ss equ 18
- reg_cs equ 16
- reg_es equ 14
- reg_di equ 12
- reg_ds equ 10
- reg_si equ 8
- reg_dx equ 6
- reg_cx equ 4
- reg_bx equ 2
- reg_ax equ 0
-
- reg_dl equ 6
- reg_cl equ 4
- reg_bl equ 2
- reg_al equ 0
-
- reg_dh equ 7
- reg_ch equ 5
- reg_bh equ 3
- reg_ah equ 1
-
- erst_b equ this byte
-
-
- emstreiber:
- dw -1,-1 ; DOS-Intern
- db 0,80h ; Flags
- soffset dw offset strat ; Strategie-Routine
- ioffset dw offset intr ; Interrupt-Routine
- db "EMMXXXX0" ; EMS-Kennung
-
-
- frame_seg dw (?)
- janus_ofs dw (?)
- db_ptr dw (?),(?)
-
-
- ; ************ Strategie-Routine des Treibers
- strat proc far
- mov cs:db_ptr,bx
- mov cs:db_ptr+2,es
- ret
- start endp
-
-
- ; ************ Treiber-Interrupt nach Installation
- newint proc far
- pushf
- push es
- push di
- les di,dword ptr db_ptr
- mov w[di+3],0100
- pop di
- pop es
- popf
- ret
- nerint endp
-
-
- ; ************ EMS/LIM 4.0-Interrupt fr Vektor $67
- emsint proc far
- push bp
- push sp
- push ss
- push cs
- push es
- push di
- push ds
- push si
- push dx
- push cx
- push bx
- push ax
-
- mov bp,sp
- push cs
- pop ds
- mov di,janus_ofs
-
- test40: ; EMS-Status ermitteln
- cmp ah,040
- jne test41
- mov b[bp+reg_ah],0
- jmp near okay
-
- test41: ; Segment des PageFrames
- cmp ah,041
- jne test42
- mov b[bp+reg_ah],0
- mov w[bp+reg_bx],frame_seg
- jmp near okay
-
- test42: ; Anzahl der EMS-Pages
- cmp ah,042
- jne test43
- mov es,0d400
- mov es:w[di+arg1],042
- call near call_and_wait
- mov es,0d400
- mov b[bp+reg_ah],0
- mov w[bp+reg_bx],es:[di+arg2]
- mov w[bp+reg_dx],es:[di+arg3]
- jmp near okay
-
- test43: ; EMS-Speicher belegen
- cmp ah,043
- jne test44
- mov es,0d400
- mov es:w[di+arg1],043
- mov es:w[di+arg2],bx
- call near call_and_wait
- mov es,0d400
- mov w[bp+reg_ax],es:[di+arg2]
- mov w[bp+reg_dx],es:[di+arg3]
- jmp near okay
-
- test44: ; Mapping setzen
- cmp ah,044
- jne test45
-
- cmp al,0
- jne bad_page
- mov es,0d400
- mov es:w[di+arg1],044
- mov es:w[di+arg2],bx
- mov es:w[di+arg3],dx
- call near call_and_wait
- mov b[bp+reg_ah],0
- jmp near okay
-
- bad_page:
- mov b[bp+reg_ah],08b
- jmp near okay
-
- test45: ; EMS-Speicher freigeben
- cmp ah,045
- jne test46
- mov es,0d400
- mov es:w[di+arg1],045
- mov es:w[di+arg2],dx
- call near call_and_wait
- mov b[bp+reg_ah],0
- jmp near okay
-
- test46: ; Version des EMS-Treibers ermitteln
- cmp ah,046
- jne test47
- mov b[bp+reg_ah],0
- mov b[bp+reg_al],01000000b
- jmp near okay
-
- test47: ; Seitentabelle sichern
- cmp ah,047
- jne test48
- mov es,0d400
- mov es:w[di+arg1],047
- mov es:w[di+arg2],dx
- call near call_and_wait
- mov b[bp+reg_ah],0
- jmp near okay
-
- test48: ; Mapping zurcksetzen
- cmp ah,048
- je mapping
- jmp near test4B
-
- mapping:
- mov es,0d400
- mov es:w[di+arg1],048
- mov es:w[di+arg2],dx
- call near call_and_wait
- mov b[bp+reg_ah],0
- jmp near okay
-
- ; 49 und 4A: Interne Funktionen
-
- test4B label near ; Anzahl der Handles ermitteln
- cmp ah,04B
- jne test4C
- mov es,0d400
- mov es:w[di+arg1],04b
- call near call_and_wait
- mov es,0d400
- mov w[bp+reg_bx],es:[di+arg2]
- mov b[bp+reg_ah],0
- jmp near okay
-
- test4C: ; Anzahl allokierter Pages ermitteln
- cmp ah,04C
- jne test4D
- mov es,0d400
- mov es:w[di+arg1],04c
- mov es:w[di+arg2],dx
- call near call_and_wait
- mov es,0d400
- mov w[bp+reg_bx],es:[di+arg2]
- mov b[bp+reg_ah],0
- jmp near okay
-
- test4D: ; Alle Handles ermitteln
- cmp ah,04D
- jne test4E
- mov ds,0d400
- mov si,cs:janus_ofs
- mov ds:w[si+arg1],04d
- call near call_and_wait
- mov w[bp+reg_bx],ds:w[di+arg2]
- mov b[bp+reg_ah],0
- mov es,w[bp+reg_es]
- mov di,w[bp+reg_di]
- mov cx,512
- rep movsw
- call near call_and_wait
- jmp near okay
-
- test4E:
- cmp ah,04E
- je test4E_sub00
- jmp near test4F
-
- test4E_sub00: ; HardPages sichern
- cmp al,0
- jne test4E_sub01
- mov es,0d400
- mov es:[di+arg1],04e00
- call near call_and_wait
- mov ds,0d400
- mov si,janus_ofs
- mov es,w[bp+reg_es]
- mov di,w[bp+reg_di]
- mov es:w[di+00],ds:w[si+arg2]
- mov b[bp+reg_ah],0
- jmp near okay
-
- test4E_sub01: ; HardPages restaurieren
- cmp al,1
- je is4E_sub01
- jmp near test4E_sub02
- is4E_sub01:
- mov ds,0d400
- mov si,janus_ofs
- mov es,w[bp+reg_es]
- mov di,w[bp+reg_di]
- mov ds:w[si+arg1],04e01
- mov ds:w[si+arg2],es:w[di+00]
- call near call_and_wait
- mov b[bp+reg_ah],0
- jmp near okay
-
- test4E_sub02: ; HardPages sichern und restaurieren
- cmp al,2
- jne test4E_sub03
- mov ah,04e
- mov al,0
- mov es,w[bp+reg_es]
- mov di,w[bp+reg_di]
- int 67h
- mov ah,04e
- mov al,1
- mov ds,w[bp+reg_ds]
- mov si,w[bp+reg_si]
- int 67h
- jmp near okay
-
- test4E_sub03: ; Gráe fr Puffer ermitteln
- cmp al,3
- jne fehler4E_sub
- mov b[bp+reg_al],4
- mov b[bp+reg_ah],0
- jmp near okay
-
- fehler4E_sub:
- mov b[bp+reg_ah],084
- jmp near okay
-
- test4F:
- cmp ah,04f
- jne test50
- mov es,0d400
- mov es:w[di+arg1],04f
- call near call_and_wait
- mov b[bp+reg_ah],0
- jmp near okay
-
- test50:
- cmp ah,050
- jne test51
- mov es,0d400
- mov es:w[di+arg1],050
- call near call_and_wait
- mov b[bp+reg_ah],0
- jmp near okay
-
- test51:
- cmp ah,051
- jne test52
- mov es,0d400
- mov es:w[di+arg1],051
- mov es:w[di+arg2],dx
- mov es:w[di+arg3],bx
- call near call_and_wait
- mov w[bp+reg_ax],es:w[di+arg2]
- jmp near okay
-
- test52:
- cmp ah,052
- jne test53
- mov w[bp+reg_ax],0
- jmp near okay
-
- test53:
- cmp ah,053
- jne test54
- mov es,0d400
- mov es:w[di+arg1],053
- call near call_and_wait
- mov b[bp+reg_ah],087
- jmp near okay
-
- test54:
- cmp ah,054
- jne test55
- mov es,0d400
- mov es:w[di+arg1],054
- call near call_and_wait
- mov b[bp+reg_ah],087
- jmp near okay
-
- test55:
- cmp ah,055
- jne test56
- mov es,0d400
- mov es:w[di+arg1],055
- call near call_and_wait
- mov b[bp+reg_ah],087
- jmp near okay
-
- test56:
- cmp ah,056
- jne test57
- mov es,0d400
- mov es:w[di+arg1],056
- call near call_and_wait
- mov b[bp+reg_ah],087
- jmp near okay
-
- test57:
- cmp ah,057
- jne test58
- mov es,0d400
- mov es:w[di+arg1],057
- call near call_and_wait
- mov b[bp+reg_ah],087
- jmp near okay
-
- test58:
- cmp ah,058
- jne test59
- cmp al,1
- je test58_sub01
- mov es,w[bp+reg_es]
- mov di,w[bp+reg_di]
- mov es:w[di+0],cs:frame_seg
- mov es:w[di+2],0
- test58_sub01:
- mov w[bp+reg_cx],1
- mov b[bp+reg_ah],0
- jmp near okay
-
- test59:
- cmp ah,059
- jne test5A
- mov es,0d400
- mov es:w[di+arg1],059
- call near call_and_wait
- mov b[bp+reg_ah],087
- jmp near okay
-
- test5A:
- cmp ah,05A
- jne test5C
- mov ah,043
- int 67h
- mov b[bp+reg_ah],ah
- mov w[bp+reg_dx],dx
- jmp near okay
-
- test5C:
- cmp ah,05c
- jne fehler
- mov b[bp+reg_ah],0
- jmp near okay
-
- fehler:
- mov b[bp+reg_ah],084
-
- okay:
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- pop ds
- pop di
- pop es
- pop bp
- pop bp
- pop bp
- pop bp
- iret
- emsint endp
-
- call_and_wait proc near
- push ds
- push es
- mov ah,7
- mov al,27
- int 0b
- mov ah,8
- mov al,27
- int 0b
- pop es
- pop ds
- ret
- call_and_wait endp
-
- wait_amiga proc near
- push ds
- push es
- mov ah,8
- mov al,27
- int 0b
- pop es
- pop ds
- ret
- wait_amiga endp
-
- pages equ this byte
-
- ; ************ Interruptroutine des Treibers
- intr proc far
- push ax
- push bx
- push cx
- push dx
- push di
- push si
- push bp
- push ds
- push es
- pushf
-
- push cs
- pop ds
-
- les di,dword ptr db_ptr
- mov bl,es:[di+befehl]
- cmp bl,0
- je bc_okay
-
- mov ax,8003h
- jmp short intr_end
-
- bc_okay:
- call init
-
- intr_end label near
- or ax,0100h
- mov es:[di+status],ax
-
- popf
- pop es
- pop ds
- pop bp
- pop si
- pop di
- pop dx
- pop cx
- pop bx
- pop ax
- ret
- intr endp
-
-
- ; ************ Installationsroutine
- init proc near
- mov word ptr es:[di+end_adr],offset pages
- mov word ptr es:[di+end_adr+2],cs
-
- mov dx,offset initm ; Installationsmeldung ausgeben
- mov ah,9
- int 21h
-
- push di ; Verbindung zum Amiga herstellen
- push es
- push ds
- mov ah,1
- mov al,27
- int 0b
- cmp di,-1
- je init_fehler
- mov janus_ofs,di
- pop ds
- pop es
- pop di
-
- mov ax,0d400
- mov dx,cs:janus_ofs
- mov cl,4
- shr dx,cl
- add ax,dx
- mov frame_seg,ax
-
- mov ah,25h ; EMS-Interrupt einbinden
- mov al,67h
- mov dx,offset emsint
- int 21h
-
- mov ioffset,offset newint ; Neue Treiber-Interruptroutine erstellen
-
- mov dx,offset sokay ; Treiber erfolgreich installiert
- mov ah,9
- int 21h
-
- xor ax,ax
- init_ende:
- ret
-
- init_fehler:
- pop ds
- pop es
- pop di
- mov dx,offset kserv
- mov ah,9
- int 21h
- mov ax,1
- mov word ptr es:[di+end_adr],offset emstreiber
- mov word ptr es:[di+end_adr+2],cs
- jmp near init_ende
- init endp
-
-
- ; ************ Installationsmeldungen beim Start
- initm db "ATUtilities EMS/LIM 4.0-Manager. Copyright (C) 1993 by Thomas Dreibholz",13,10,"$"
- sokay db "Treiber wurde erfolgreich installiert.",13,10,"$"
- kserv db "FEHLER: Amiga-Treiber ist nicht aktiv.",13,10
- db "Treiber konnte nicht installiert werden.",13,10,10,"$"
-
- code ends
- end